package com.mk.sso.boot;

import com.mk.sso.sdk.conf.SsoConf;
import org.springframework.context.annotation.Condition;
import org.springframework.context.annotation.ConditionContext;
import org.springframework.core.env.Environment;
import org.springframework.core.type.AnnotatedTypeMetadata;

public class WebAppCondition implements Condition {

    @Override
    public boolean matches(ConditionContext context, AnnotatedTypeMetadata metadata) {
        //获取当前环境信息
        Environment environment = context.getEnvironment();
        String property = environment.getProperty("easy.sso.client.client-type", SsoConf.WEB_CLIENT);
        if (property.equals(SsoConf.WEB_CLIENT)) {
            return true;
        } else {
            return false;
        }
    }
}
